package softWare;

public class PrimeNumber {
    public static void main(String[] args) {
        primeNumber(20000);
    }

    public static void primeNumber(int max){
        int cnt=1;
        System.out.print("1"+" ");
        for(int i=2;i<max;i++){
            boolean isPrime = true;
            for(int j=2;j<=(int)Math.sqrt(i);j++){
                if(i%j==0){
                    isPrime = false;
                    break;
                }
            }
            if(isPrime){
                System.out.print(i+" ");
                cnt++;
                if(cnt%5==0)
                    System.out.println("");
            }
        }
    }
}
